// index.js
// 获取应用实例
const app = getApp()
Page({
  data: {
      famerlist:[
        {fname:'黄瓜',url:'/images/hg.jpg'},
       
      ],
      resData:[],
      url:""
     
  },
  clickGoodds:function(res){
    var id=res.currentTarget.dataset.id;
    console.log(id)
    wx.reLaunch({
      url: '/pages/searchGoods/searchGoods?id='+id
    })
    
  },
  onLoad:function(options){
      wx.showLoading({
        title: '数据等待....',
        // mask:true
      }),
      this.getlist()
  },
  getlist:function(){
    wx.request({
      url: 'http://47.94.153.89:9000/farm.php/index/getDeviceAll',//php地址
      header:{
        "X-Token-Id" : wx.getStorageSync('token')
      },
      success:res=>{
       this.setData({
          resData:res.data,
          id:res.data.id,
        }),
        wx.hideLoading()
        console.log(res.data)
      }
    })
  }
  
})
